import { Controller, Get, Post, Body, Patch, Param, Delete, Query, HttpCode } from '@nestjs/common';
import { WebConfigService } from './web-config.service';
import { CreateWebConfigDto } from './dto/web-config.dto';
import { ApiResponse, ApiOperation, ApiBody, ApiQuery, ApiTags } from '@nestjs/swagger';
import { WebConfigEntity } from './entities/web-config.entity';
@Controller('web-config')
@ApiTags('网站设置')
export class WebConfigController {
  constructor(private readonly webConfigService: WebConfigService) { }

  @Get('/getWebConfig')
  @ApiResponse({
    status: 200,
    description: '获取网站配置',
    type: WebConfigEntity,
  })
  @ApiOperation({ summary: '获取网站配置', operationId: 'getWebConfig' })
  getWebConfig() {
    return this.webConfigService.getWebConfig();
  }
  @HttpCode(200)
  @Post('/setWebConfig')
  @ApiQuery({
    description: '设置网站配置',
    type: CreateWebConfigDto,
  })
  @ApiBody({
    description: '设置网站配置',
    type: CreateWebConfigDto,
  })
  @ApiOperation({ summary: '设置网站配置', operationId: 'setWebConfig' })
  setWebConfig(@Body() body: CreateWebConfigDto) {
    return this.webConfigService.setWebConfig(body);
  }
}
